<template>
  <div class="app-container">
    <div class="filter-container">
      <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getList"
        >
        查询
      </el-button>
    </div>
    <el-table v-loading="listLoading" :data="list" border fit highlight-current-row lazy :load="load" row-key="id"
      :tree-props="{children: 'children', hasChildren: 'hasChildren'}" style="width: 100%;">
      <el-table-column label="公司名称" prop="companyName" align="center" />
      <el-table-column label="企业状态" prop="statusText" align="center" />
      <el-table-column label="商户编码" prop="identifier" align="center" />
      <el-table-column label="联系人" prop="name" align="center" />
      <el-table-column label="联系方式" prop="mobile" align="center" />
      <el-table-column label="提交审核时间" prop="submitAuditTime" align="center" />
    </el-table>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { getCustomerRelation } from '@/api/user'
import waves from '@/directive/waves' // waves directive

export default {
  name: 'RecommendUser',
  directives: { waves },
  props: {},
  components: {

  },
  data() {
    return {
      list: [],
      listQuery: {
        parentId: '',
        type: 1
      },
      listLoading: false,
    }
  },
  computed: {
    ...mapGetters([
      'userInfo'
    ])
  },
  methods: {
    getList() {
      this.listLoading = true
      this.listQuery.parentId = this.userInfo.username
      getCustomerRelation(this.listQuery).then(response => { 
        this.listLoading = false
        this.list = response || []
      }).catch(error => {
        console.log(error);
        this.listLoading = false
      })
    },
    load(tree, treeNode, resolve) {
      getCustomerRelation({ parentId: tree.id, type: 1 }).then(response => { 
        resolve(response || [])
      }).catch(error => {
        console.log(error);
      })
    }
  },
  created() {
    this.getList()
  },
  mounted() {
    
  },
  beforeCreate() {},
  beforeMount() {},
  beforeUpdate() {},
  updated() {},
  beforeDestroy() {},
  destroyed() {},
  activated() {},
}
</script>

<style lang='scss' scoped>
  
</style>